package com.cl.edu.service.teacher;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.cl.core.orm.Page;
import com.cl.edu.dao.TsDAO;
import com.cl.edu.entity.Message;
import com.cl.edu.entity.Ts;

@Service
@Transactional
public class TsManager {
	
	@Autowired
	private TsDAO tsDAO;
	 
	/**
	 * 分页查询用户的投诉信息 
	 * @param page
	 * @param to
	 * @return
	 */
	public Page<Ts> getTsPage(Page<Ts> page,Long fromId) {
		StringBuffer hql = new StringBuffer("from Ts model");
		hql.append(" where model.fromId=").append(fromId);
		hql.append(" order by model.").append(page.getOrderBy()).append(" ").append(page.getOrder());
		page = tsDAO.findPage(page, hql.toString());
		return page;
	}
	
	/**
	 * 新增投诉
	 * @param ts
	 */
	public void addTs(Ts ts){
		tsDAO.save(ts);
	}
}
